package com.telewave.stompdemo.handlers;

import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandler;

import java.lang.reflect.Type;

/**
 * TODO
 *
 * @author looveh
 * @since 2023/10/26 14:29:47
 **/
public class MyStompSessionHandler implements StompSessionHandler {

    @Override
    public void afterConnected(StompSession session, StompHeaders connectedHeaders) {
        System.out.println("连接MQ成功");
    }

    @Override
    public void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable exception) {
        System.out.println("连接MQ异常");
    }

    @Override
    public void handleTransportError(StompSession session, Throwable exception) {
        System.out.println("处理MQ传输异常");
    }

    @Override
    public Type getPayloadType(StompHeaders headers) {
        System.out.println("载荷类型");
        return null;
    }

    @Override
    public void handleFrame(StompHeaders headers, Object payload) {
        System.out.println("handleFrame");
    }
}
